<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/common/base.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
<script type="text/javascript">
	
	var ligergrid = null;
	
    $(function ()
    {
        ligergrid = $("#maingrid").ligerGrid({
            columns: [
              { display: '区域名称', name: 'categoryName', width:'20%'},
              { display: '统计信息集', name: 'setName', width:'20%'},
              { display: '统计时间类型', name: 'itemStatTimeName', width:'20%'},
              { display: '所在党组织', name: 'itemUnitName', width:'20%'},
              {
                  display: '操作', isAllowHide: false,width:'18%',
                  render: function (row)
                  {
                      var html = '';
                    	  html += '<a href="#" onclick="categoryUpdate(\'' + row.id + '\')" class="update-btn">编辑</a>||';
                    	  html += '<a href="#" onclick="categoryDelete(\'' + row.id + '\')" class="update-btn">删除</a>';
                      return String.format(html,row.annualId);
                  }
              }

            ],
            url: '${ctx}/reportStatCategoryController/tableData',
            pageSize: 10, sortName: 'categoryName',
            width: '99%', height: '96%', rownumbers:true,
            pageParmName:'pageNum',
            pagesizeParmName:'pageSize',
            sortnameParmName:'sortname',
            sortorderParmName:'sortorder',
            alternatingRow:true,
        });
    });
    
    function insertCategory(){
    	$.layer({
		    type: 2,
		    maxmin: true,
		    shadeClose: true,
		    title: '新增数据区域',
		    shade: [0.1,'#000000'],
		    shift:'top',
		    offset: [($(window).height() / 20)+'px',''],
		    area: ['600px', '350px'],
		    iframe: {src: '${ctx}/reportStatCategoryController/toReportStatCategoryInfoInsert'}
		}); 
    }
    
    function categoryUpdate(id){
    	$.layer({
		    type: 2,
		    maxmin: true,
		    shadeClose: true,
		    title: '修改数据区域',
		    shade: [0.1,'#000000'],
		    shift:'top',
		    offset: [($(window).height() / 20)+'px',''],
		    area: ['600px', '350px'],
		    iframe: {src: '${ctx}/reportStatCategoryController/toReportStatCategoryInfoUpdate/'+id}
		}); 
    }
    
    function categoryDelete(id){
		layer.confirm('是否删除',function(){
			$.ajax({
				url:'${ctx}/reportStatCategoryController/deleteReportStatCategory/'+id,
				type:'POST',
				cache:false,
				success:function(data){
					if(data == 'success'){
						layer.alert('操作成功',9);
						ligergrid.loadData();
					}else{
						layer.alert('操作失败');
					}
				}
			});
		});
	}
</script>
</head>
<body>
	<div style="margin-right:15px;margin-top:5px;padding:5px;border:0px solid green;position:relative;">
		<div class="control-group">
			<div class="controls">
				<div class="controls">
					<input type="button" class="btn btn-info" value="新增数据区域" onclick="insertCategory();" />
				</div>
			</div>
		</div>
	</div>
	<div id="maingrid" style="margin:5px; padding:0;height:90%"></div>
	<div style="display:none;"></div>
</body>
</html>